﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>加油</title>
    <link href="/CSS/Module/public.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/Module/QD1.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/Module/QC1.css" rel="stylesheet" type="text/css" />

    <script src="/JS/jquery.js" type="text/javascript"></script>

    <script src="/JS/jyAjax.js" type="text/javascript"></script>

    <script src="/JS/module.js" type="text/javascript"></script>

    <link href="/JS/MsgBox/moonbox.css" rel="stylesheet" type="text/css" />

    <script src="/JS/MsgBox/moonbox.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
        $(function(){
            $("#sulDiv input[type=checkbox]").click(function(){
                var cItems = $("#selectIdHidden").val();                
                var cId=this.id.replace("checkbox","");
                var number=parseInt($("#numberHidden").val()); 
                var maxNumber=parseInt($("#maxNumberHidden").val()); 
                if(this.checked){
                    cItems=cItems+cId+",";
                    number=number+1;
                }else{
                    cItems=cItems.replace(cId+",","");
                    number=number-1;
                }
                var chks = $("#sulDiv input[type=checkbox]");                
                if(number>=maxNumber){                
                    for(var i=0;i<chks.length;i++){                                        
                        if(!chks[i].checked){
                            chks[i].disabled="disabled"; 
                        }else{
                            chks[i].disabled=""; 
                        } 
                    }
                                           
                }else{
                    for(var j=0;j<chks.length;j++){                    
                        chks[j].disabled="";  
                    }                   
                }
			$("#selectIdHidden").val(cItems);
			$("#numberHidden").val(number);			 			    
		})		
    })
    
    function Validate(){
        var number=$("#numberHidden").val(); 
        var maxNumber=$("#maxNumberHidden").val(); 
        if(number==maxNumber){
            PostAjax('/Module/Club/MyClub.ashx','Action=Formation&ClubId=$ModuleId$&SelectedId='+$('#selectIdHidden').val());
        }else{
            $.moonbox.warning('请选择'+maxNumber+'个队员参加比赛！');
        }
    }
    
    function InitialLizePage(){        
        var number=$("#numberHidden").val(); 
        var maxNumber=$("#maxNumberHidden").val();        
        var chks = $("#sulDiv input[type=checkbox]");
        if(number>=maxNumber){                
               for(var i=0;i<chks.length;i++){                                        
                   if(!chks[i].checked){
                       chks[i].disabled="disabled"; 
                   }else{
                       chks[i].disabled=""; 
                   } 
               }
                                      
           }else{
               for(var j=0;j<chks.length;j++){                    
                   chks[j].disabled="";  
               }                   
           }					 			    
	}
	
	function SelectChange(){	    
	    var id=$("#select").val();
	    var src="/JyIMG/Form/"+id+".png";
	    $("#formImg").attr("src",src);	    
	}
    </script>

</head>
<body>
    $Header$ $MainMenu$
    <div class="Middle">
        $LeftMenu$
        <div class="Content">
            $ContentClub$
            <div class="MiddleTitle">
                <ul>
                    <li class="FontBlueB">$ClubName$：</li>
                    <li class="FontRedB">我的球队</li>
                </ul>
            </div>
            <div class="QD1Team">
                <div class="QD1TeamLeft">
                    <div class="QD1TeamLeftTop">
                        <ul>
                            <li>球队信息</li></ul>
                    </div>
                    <form action="" method="post">
                    <input id="hiddenModuleId" name="hiddenModuleId" type="hidden" value="$ModuleId$" />
                    <div class="QD1TeamLeftMiddle1">
                        <ul>
                            <li>号码</li>
                            <li>球员</li>
                            <li>能力值</li>
                            <li>位置</li>
                        </ul>
                    </div>
                    <div id="sulDiv" class="QD1TeamLeftMiddle2">
                        $SUl$
                    </div>
                    <div class="QD1TeamLeftMiddle3">
                        <input type="hidden" id="selectIdHidden" name="selectIdHidden" value="$Formation$" />
                        <input type="hidden" id="numberHidden" name="numberHidden" value="$Number$" />
                        <input type="hidden" id="maxNumberHidden" name="maxNumberHidden" value="$MaxValue$" />
                        <input name="input2" type="button" onclick="Validate()" class="BtnBlueBg" value="首发阵容" />
                    </div>
                    </form>
                </div>
                <div class="QD1TeamRight">
                    <div class="QD1TeamLeftTop">
                        <ul>
                            <li>阵型设置</li></ul>
                    </div>
                    <form action="" method="post">
                    <div class="QD1TeamRightMiddle1">
                        <img id="formImg" src="" alt="" /></div>
                    <div class="QD1TeamRightMiddle2">
                        <label>
                            <select name="select" id="select" onchange="SelectChange()">
                                $Option$
                            </select>
                        </label>
                        <input name="input" type="button" class="BtnBlueBg" onclick="PostAjax('/Module/Club/MyClub.ashx','Action=Form&ClubId=$ModuleId$&SelectedId='+$('#select').val())"
                            value="保存阵型" />
                    </div>
                    </form>
                </div>
            </div>

            <script type="text/javascript" language="javascript">
                $(function(){InitialLizePage(),SelectChange()})
            </script>

            <div class="QC1Player">
                <div class="QC1PlayerLine1">
                    <ul>
                        <li>好友</li>
                        <li>场地名</li>
                        <li>场地等级</li>
                        <li>状态</li>
                    </ul>
                    <ul>
                        <li>好友</li>
                        <li>场地名</li>
                        <li>场地等级</li>
                        <li>状态</li>
                    </ul>
                </div>
                <div class="QC1PlayerLine2">
                    $VUl$
                </div>
            </div>
            <div class="QC1Player">
                <div class="QC1PlayerLine1">
                    <ul>
                        <li>好友</li>
                        <li>中心名</li>
                        <li>中心等级</li>
                        <li>状态</li>
                    </ul>
                    <ul>
                        <li>好友</li>
                        <li>中心名</li>
                        <li>中心等级</li>
                        <li>状态</li>
                    </ul>
                </div>
                <div class="QC1PlayerLine2">
                    $TUl$
                </div>
            </div>
            <div class="TableTop">
                <div class="TableMenu">
                    <ul>
                        <li class="Infobtn"><a onclick="fillhtml('InfoDiv','/Module/Venues/GetState.ashx?Type=State&ModuleId=$ModuleId$'+'&'+ Math.random())">
                            我的动态</a></li>
                        <li><a onclick="fillhtml('InfoDiv','/Module/Venues/GetState.ashx?Type=Race&ModuleId=$ModuleId$'+'&'+ Math.random())">
                            好友参赛历史</a></li>
                    </ul>
                </div>
            </div>
            <div class="TableMiddle">
                <div id="InfoDiv" class="QC1PlayInfoLine2">
                </div>
            </div>
            <div class="TableBottom">
            </div>
        </div>
    </div>

    <script type="text/javascript" language="javascript">$(function(){fillhtml('InfoDiv','/Module/Venues/GetState.ashx?Type=State&ModuleId=$ModuleId$'+'&'+ Math.random())})</script>

    $Footer$
</body>
</html>
